

public class WeaponFactory {
    //类：英雄的武器工厂
    static Weapon weapon;
    public static Weapon getWeapon(int type)
    {
        switch (type) {
            case 1:
                weapon = new SimpleWeapon(1);//白色子弹
                break;
            case 2:
                weapon = new StrongWeapon(1);//红色子弹
                break;
            case 3:
                weapon = new ShotWeapon(1);//散射子弹
                break;
            case 4:
                weapon = new NunLinerWeapon(1);//旋转子弹
                break;
            default:
                weapon = new SimpleWeapon(1);
        }

        return weapon;
    }
}
